package tree;

import java.util.Hashtable;

public class SymTable
{//symbol table

    private Hashtable<String, Integer> stbl;

    public void reserve(String key, int value)
    { stbl.put(key, value); }

    public SymTable()
    {
        stbl = new Hashtable<String, Integer>();
        reserve("if", Tag.IF);
        reserve("else", Tag.ELSE);
        reserve("while", Tag.WHILE);
        reserve("do", Tag.DO);
        reserve("break", Tag.BREAK);
        reserve("true", Tag.TRUE);
        reserve("false", Tag.FALSE);
        reserve("int", Tag.INT);
        reserve("bool", Tag.BOOL);
    }

    public Integer find(String s)
    {
        if(stbl.get(s)==null)
            return -1;
        else
            return stbl.get(s);
    }
}